//
// Created by v on 19-5-23.
//

#include "OpenGLQt.h"
#include "CMVideoDecoderFile.h"
#include "common/cm_common.h"

int main(int argc, char **args) {

    LOGD("program started\n");
    CMVideoDecoder *dc = new CMVideoDecoderFile("/sdcard/y/1.mp4");
    int ret = dc->init();
    if (ret < 0) {
        LOGD("Error: decode init [%d]\n", ret);
    }
    ret = dc->open();
    if (ret < 0) {
        LOGD("Error: decode open [%d]\n", ret);
    }
    OpenGLQt *qtgl = new OpenGLQt(480, 320);
    qtgl->setDecoder(dc);

    qtgl->test_window_gl_easy();
//    qtgl->create_window(480, 320);

    int count = 0;
    while (count++ < 5000) {
//        qtgl->show_yuv();
//        qtgl->show_img_normal();
//        qtgl->show_img();
        qtgl->show_decode_img();
        usleep(20000);
    }

    delete dc;

    LOGD("program exit\n");
    return 0;
}